import requests

from common.py01_IhrmAssertUtil import common_assert

# 员工登录
url_login = "http://ihrm-java.itheima.net/api/sys/login"
header={"Content-Type":"application/json"}
login_data = {"mobile": "13800000002", "password": "929itheima.CN032@.20250417"}

resp_login = requests.post(url=url_login, headers=header,json=login_data)

token="Bearer "+resp_login.json().get("data")
print(token)



# 新增员工
url_insert = "http://ihrm-java.itheima.net/api/sys/user"
header_insert = {"Content-Type": "application/json", "Authorization": token}
insert_data = {
    "username": "ai",
    "mobile": "18312345145",
    "form0fEmployment": 1,
    "departmentName": "测试0002",
    "departmentID": "234",
    "correctionTime": "2025-07-30T16:00:00.000Z"
}
resp_insert = requests.post(url=url_insert, headers=header_insert, json=insert_data)
print(resp_insert.json())


